widget: Fix priv dereference in size_allocate_with_baseline
authorTimm Bäder <mail@baedert.org>
Sun, 9 Jul 2017 14:42:19 +0000 (16:42 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:15 +0000 (21:27 -0400)
Accessing ->priv is only safe *after* the GTK_IS_WIDGET precondition, so
use the get_instance_private function instead.

gtk/gtkwidget.c

index 867e2a662d64cbc68e35643de8452d040f059091..ed0a34cb4a032a165e6633927feb91062ebb5446 100644 (file)
@@ -5381,7 +5381,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
                                        GtkAllocation *allocation,
                                        gint           baseline)
 {
-  GtkWidgetPrivate *priv;
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GdkRectangle real_allocation;
   GdkRectangle old_allocation, old_clip;
   GdkRectangle adjusted_allocation;
@@ -5395,8 +5395,6 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
   GtkCssStyle *style;
   GtkBorder margin, border, padding;
 
-  priv = widget->priv;
-
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   if (!priv->visible && !_gtk_widget_is_toplevel (widget))